<!DOCTYPE html>

<head>
	<title>公会战 - 数据分析</title>
	<meta name='viewport' content='width=480' charset="utf-8" />
	<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.min.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.min.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.0/index.js"></script>
	<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.0/theme-chalk/index.css">
	<style>
		body {
			text-align: center;
		}

		.el-row {
			margin-bottom: 15px;
		}

		.lib {
			display: inline-block;
			text-align: center;
			margin: 10px;
		}

		.lib2 {
			display: inline-block;
			width: 80px;
			margin: 5px;
		}
	</style>
</head>

<body>
	<div id="app">
		<el-page-header @back="location='..'" content="数据统计"></el-page-header>
		<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleTitleSelect">
			<el-menu-item index="1">面板</el-menu-item>
			<el-menu-item index="2">预约</el-menu-item>
			<el-menu-item index="3">查刀</el-menu-item>
			<el-menu-item index="4">统计</el-menu-item>
			<el-menu-item index="5">我的</el-menu-item>
		</el-menu>
		<h1 style="text-align:center">选择查看方式</h1><br>
		<el-row>
			<el-button class="lib" type="primary" @click="location.href='./1/'"><img style="width:100px;height:100px"
					src="{{ url_for('yobot_static', filename='clan/statistics/order.png') }}"><br><br>出刀顺序</el-button>
			<el-button class="lib" type="warning" @click="location.href='./2/'"><img style="width:100px;height:100px"
				src="{{ url_for('yobot_static', filename='clan/statistics/pie.png') }}"><br><br>数据图表</el-button>
			<a href="#" target="_blank" id="clan-battle-analyzer">
				<el-button class="lib" type="danger"><img style="width:100px;height:100px" src="{{ url_for('yobot_static', filename='clan/statistics/deviation.png') }}"><br><br>均值偏差</el-button>
			</a>
			<a href="#" target="_blank" id="pcrd-yobot-fe">
				<el-button class="lib" type="success"><img style="width:100px;height:100px"
					src="{{ url_for('yobot_static', filename='clan/statistics/many.png') }}"><br><br>多维分析</el-button>
			</a>
		</el-row>
		<h2>原始数据</h2>
		<div class="lib2"><a href="./api/"><button class="el-button el-button--info el-button--small">查看本轮</button></a>
		</div>
		<div class="lib2"><a href="./api/" download><button
					class="el-button el-button--info el-button--small">下载本轮</button></a><br></div>
		<div class="lib2"><a href="./api/?battle_id=all"><button
					class="el-button el-button--info el-button--small">查看全部</button></a></div>
		<div class="lib2"><a href="./api/?battle_id=all" download><button
					class="el-button el-button--info el-button--small">下载全部</button></a><br></div>
		<br><br><br>
		<div>
			{% if allow_api -%}
			<input id="apiurl" style=" position: fixed;width: 5px;top: -30px;height: 6px;" readonly />
			<input type="button" value="获取api" id="copy" class="el-button el-button--mini">
			{% else -%}
			api访问已禁用，如需开启请前往<a href="../setting/">
				<el-button size="mini">公会设置</el-button>
			</a>
			{% endif -%}
		</div>
	</div>
	<!-- 
	出刀顺序 by @Ai-Himmel https://github.com/Ai-Himmel
	数据图表 by @Diving-Fish & @Winrey https://github.com/Diving-Fish
	均值偏差 by @Alive24 https://github.com/Alive24 @Librazy https://github.com/Librazy/pcr-clan-battle-analyzer-vue
	多维分析 by @Tan90Qian https://github.com/Tan90Qian

	更多统计方式欢迎提交 pull request，建议采用 api 调用的方式 
-->
	<p>

	</p>
	<el-footer style="text-align: center;position: fixed;bottom: -10px;left: 50%;transform: translate(-50%, -50%);background-color: #66b1ff;color: #ffffff;
width: 100%;font-size:15px;">
		powered by <a href="https://github.com/pcrbot/yobot" style="text-decoration:none;color: #ffffff;">yobot</a>
	</el-footer>
</body>

<script src="{{ url_for('yobot_static', filename='clan/statistics.js') }}"></script>
<script>
	var apikey = "{{ apikey }}";
	var apiurl = window.location.href + "api/?apikey=" + apikey
	document.getElementById("apiurl").value = apiurl;
	document.getElementById("pcrd-yobot-fe").href = "http://tools.yobot.win/pcrd-yobot-fe/#" + encodeURIComponent(apiurl);
	document.getElementById("clan-battle-analyzer").href = "http://librazy.reinwd.moe/?apiURL=" + encodeURIComponent(apiurl);
	document.getElementById("copy").addEventListener("click", e => {
		document.getElementById("apiurl").select();
		document.execCommand("Copy");
		alert("API已复制到剪贴板");
	})
</script>

</html>
<!--
        api说明：
        公会战管理员在设置中开启“允许外部api调用”后，可在外部直接调用，
        也可以直接下载json文件
        
        参数：

        apikey：外部调用时必填
        battle_id：整数，公会战的场次号码，填“current”获取当前，填“all”则获取所有，默认值“current”

        返回数据：

        code：0是成功，其他值是失败
        api_version：api版本号，整数
        message：失败原因
        groupinfo：群组信息
        members：成员列表
        challenges：出刀记录表
	-->
